<style>
    .upload-image {
        background: url('__CDN__/assets/addons/example/img/plus.png') no-repeat center center;
        background-size: 35px 35px;
        height: 35px;
        width: 35px;
        border: 1px solid #ccc;
    }

    textarea.form-control {
        background: #eee;
    }
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('秒杀时间')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-category_id" data-rule="required"
                   data-source="seckill/index"
                   data-params='{"custom[status]":"1"}'
                   class="form-control selectpage" name="row[seckill_id]"
                   type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('封面图')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-image" class="form-control" size="50" name="row[image]" type="text">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" ><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-image"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-image"></ul>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-images" class="form-control" size="50" name="row[images]" type="text">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-images"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-images"></ul>
        </div>
    </div>

<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('Original_price')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <input id="c-original_price" data-rule="required" class="form-control" step="0.01" name="row[original_price]" type="number" value="0.00">-->
<!--        </div>-->
<!--    </div>-->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('秒杀价')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-price" data-rule="required" class="form-control" step="0.01" name="row[price]" type="number" value="0.00">
        </div>
    </div>

<!--    增加规格-->

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('规格')}:</label>
        <div class="col-xs-12 col-sm-8">
            <table class="table fieldlist" data-template="eventtpl" data-name="row[event]" id="second-table">
                <tr>
                    <td>{:__('图片')}</td>
                    <td>{:__('规格名称')}</td>
                    <td>{:__('秒杀价')}</td>

                    <td>{:__('库存')}</td>
<!--                      <td>{:__('赠送能量值')}</td>-->
<!--                    <td>{:__('赠送代理天数')}</td>-->
                    <td width="100"></td>
                </tr>
                <tr>
                    <td colspan="4"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></td>
                </tr>
            </table>

            <!--请注意实际开发中textarea应该添加个hidden进行隐藏-->
            <textarea data-rule="required" name="row[event]" class="form-control hidden " cols="30" rows="5">[]</textarea>
            <script id="eventtpl" type="text/html">
                <tr class="form-inline">
<!--                    <td><input type="text" name="<%=name%>[<%=index%>][id]" class="form-control selectpage" data-source="auth/admin/selectpage" data-field="username" value="<%=row.id%>" placeholder="管理员"/></td>-->

                    <td>
                        <input type="hidden" name="<%=name%>[<%=index%>][image]" id="c-image-<%=index%>" value="<%=row.image%>">
                        <!--@formatter:off-->
                        <button type="button" id="faupload-image" class="btn btn-danger faupload upload-image" data-input-id="c-image-<%=index%>" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" <%if(row.image){%>style="background-image: url('<%=Fast.api.cdnurl(row.image)%>')"<%}%>></button>
                        <!--@formatter:on-->
                    </td>
                    <td><input type="text" name="<%=name%>[<%=index%>][name]" class="form-control" style='width:100px' size="15" value="<%=row.name%>" placeholder="名称"/></td>
                    <td><input type="text" name="<%=name%>[<%=index%>][price]" class="form-control" style='width:100px' size="15" value="<%=row.price%>" placeholder="代理价"/></td>
                    <td><input type="text" name="<%=name%>[<%=index%>][stock]" class="form-control" style='width:100px' size="15" value="<%=row.stock%>" placeholder="库存"/></td>

                    
                    <td>
                        <!--下面的两个按钮务必保留-->
                        <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
                        <span class="btn btn-sm btn-primary btn-dragsort hidden"><i class="fa fa-arrows"></i></span>
                    </td>
                </tr>
            </script>
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
        </div>
    </div>
    <div class="form-group hidden">
        <label class="control-label col-xs-12 col-sm-2">{:__('Employ_ids')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-employ_ids"
                data-source="employ/index"
                   data-multiple="true" class="form-control selectpage"
                   name="row[employ_ids]" type="text" value="">
        </div>
    </div>
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <div class='control-relative'><input id="c-city" class="form-control" data-toggle="city-picker" name="row[city]" type="text"></div>-->
<!--        </div>-->
<!--    </div>-->
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('Views')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <input id="c-views" data-rule="required" class="form-control" name="row[views]" type="number" value="0">-->
<!--        </div>-->
<!--    </div>-->
  
    <!--<div class="form-group">-->
    <!--    <label class="control-label col-xs-12 col-sm-2">{:__('推荐')}:</label>-->
    <!--    <div class="col-xs-12 col-sm-8">-->
    <!--        <input  id="c-suggest" name="row[suggest]" type="hidden" value="0">-->
    <!--        <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-switch" data-yes="1" data-no="0" >-->
    <!--            <i class="fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x"></i>-->
    <!--        </a>-->
    <!--    </div>-->
    <!--</div>-->
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('能量值')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="0.00">-->
<!--        </div>-->
<!--    </div>-->
    <div class="form-group hidden">
        <label class="control-label col-xs-12 col-sm-2">{:__('Freight_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-freight_id" data-source="freight/index" class="form-control selectpage" name="row[freight_id]" type="text" value="">
        </div>
    </div>
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('代理天数')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <input id="c-agent_day" data-rule="required" class="form-control" name="row[agent_day]" type="number" value="0">-->
<!--        </div>-->
<!--    </div>-->
<!--    -->
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('客服地址')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <input id="c-service_url"  class="form-control" name="row[service_url]" type="text" value="">-->
<!--        </div>-->
<!--    </div>-->
    
    <div class="form-group hidden">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">

            <div class="radio">
            {foreach name="statusList" item="vo"}
            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="3"}checked{/in} /> {$vo}</label>
            {/foreach}
            </div>

        </div>
    </div>
      <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="0">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
        </div>
    </div>
</form>
